package com.wl.day44.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.wl.day44.model.Book;
import com.wl.day44.model.BookType;

public interface BookDAO {
	@Select("select * from books")
	@Results({
		@Result(id=true, column="book_id", property="bookId"),
		@Result(column="book_author", property="bookAuthor"),
		@Result(column="book_name", property="bookName"),
		@Result(column="book_desc", property="bookDesc"),
		@Result(column="create_date", property="createDate", javaType=Date.class),
		@Result(column="type_id", property="type", javaType=BookType.class,
		one=@One(select="com.wl.day44.dao.BookTypeDAO.findById"))
	})
	public List<Book> findAll();
}
